package com.duolaibei.business.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.duolaibei.business.R;
import com.duolaibei.business.base.BaseActivity;
import com.duolaibei.business.utils.CommonUtil;
import com.duolaibei.business.utils.inject.Inject;

/**
 * Created by xlm on 2017/11/10 0010
 */

public class SearchWorkerActivity extends BaseActivity {

    @Inject(R.id.back)
    private RelativeLayout mLayoutBack;
    @Inject(R.id.title)
    private TextView mViewTitle;
    @Inject(R.id.begin_search)
    private TextView mTextViewSearch;

    @Inject(R.id.worker_name)
    private EditText mEditTextWorkerUid;

    @Override
    protected void onSetContentView() {
        setContentView(R.layout.activity_search_worker);
    }

    @Override
    protected void initViews() {
        mViewTitle.setText("员工搜索");
    }

    @Override
    protected void afterOnCreate(Bundle savedInstanceState) {

    }

    @Override
    protected void onSetListener() {
        mLayoutBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mTextViewSearch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String worker_uid = mEditTextWorkerUid.getText().toString();
                if (CommonUtil.isEmpty(worker_uid)) {
                    showToast("请输入员工UID");
                    return;
                }
                Intent intent = new Intent();
                intent.putExtra("worker_uid", worker_uid);
                intent.putExtra("type", "part");
                setResult(RESULT_OK, intent);
                finish();
            }
        });
    }

}
